package commande.os.windows;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import librairies.liste.interfaces.IListeE;
import librairies.liste.list.ListeDCE;

import commande.interfaces.IConsole;
import commande.outils.Processus;

/**
 * Gestion de la console sous windows. 
 * 
 * @author mlozach
 */
public class ConsoleWindows implements IConsole
{
	@Override
	public IListeE<String> rechercheFichier(String racine, String recherche)
	{
		Process pro = null;
		InputStream is = null;
		InputStreamReader isr = null;
		BufferedReader br = null;
		IListeE<String> retour = new ListeDCE<String>();
		
		try
		{
			pro = Runtime.getRuntime().exec(""); //TODO a trouver la commande un jour

    		is = pro.getInputStream();
            isr = new InputStreamReader(is);
            br = new BufferedReader(isr);
            String ligne = null;
            
            while((ligne = br.readLine()) != null)
            {
               retour.add(ligne);
            }
        } 
		catch (IOException ioe)
		{
            ioe.printStackTrace();
        }
		return retour;
	}

	@Override
	public Processus execution(String nom, String argument) throws IOException
	{
		//TODO a faire un jour.
		return null;
	}
}
